package leecode

import "sort"

func deleteGreatestValue(grid [][]int) int {
	result := 0
	for i := 0; i < len(grid); i++ {
		temp := make([]int, len(grid[0])-i)
		for j := 0; j < len(grid[i])-i; j++ {
			temp[j] = grid[i][j]
		}
		sort.Ints(temp)
		result += temp[len(temp)-1]
	}
	return result
}
